using System;
using System.Collections.Generic;
using System.Text;
using Hoshimi._Behaviour_._Group_.MasterCollectorGroup;

namespace Hoshimi
{
	public class ComplexCollectorGroup_ReleaseState : State
	{
		#region Singleton

		// Fields
		protected static ComplexCollectorGroup_ReleaseState instance;

		// Constructor
		protected ComplexCollectorGroup_ReleaseState() : base() { }

		// Methods
		public static ComplexCollectorGroup_ReleaseState Instance()
		{
			// Uses "Lazy initialization"
			if( instance == null ) 
				instance = new ComplexCollectorGroup_ReleaseState();

			return instance;
		}

		#endregion

		public override bool Play( Unit unit )
		{
			ComplexCollectorGroup myGroup = (ComplexCollectorGroup) unit;
		
			// We ask father to release the group
			if (myGroup.myFather != null)
			{
				((MasterCollectorGroup)myGroup.myFather).RemoveGroup(myGroup);
			}

			return true;
		}
	}
}
